package com.fqh.service.impl;

import com.fqh.entity.Login;
import com.fqh.mapper.UserMapper;
import com.fqh.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper mapper;

    public List<Login> checkByUsernameAndPassword(String telephone, String pwd) {
        List<Login> list = mapper.checkByUsernameAndPassword(telephone, pwd);
        return list;
    }

    public List<Login> findUsername(String username) {
        return mapper.findUsername(username);
    }

    public List<Login> findTelephone(String telephone) {
        return mapper.findTelephone(telephone);
    }

    public void addUser(String username, String password, String telephone) {
        mapper.addUser(username, password, telephone);
    }

    public void changePwd(Integer loginId, String pwd) throws Exception {
        mapper.changePwd(loginId, pwd);
    }
}
